<div class="pager" th:unless="${#lists.isEmpty(products)}">
    <ul class="pagination">
        <span th:remove="tag" th:with="start=${result.page-2>0?result.page-2:1},end=${start+4>result.totalPages?result.totalPages:start+4}">
            <li title="上一页">
                <a th:if="${result.page==1}" href="javascript:viod(0);" class="disabled">«</a>
                <a th:unless="${result.page==1}" blc:paginationpagelink="${result.page-1}">
                    <span>«</span>
                </a>
            </li>
            <span th:remove="tag" th:if="${start==2}">
                <li><a blc:paginationpagelink="${1}" th:text="${1}"></a></li>
            </span>
            <span th:remove="tag" th:if="${start>2}">
                <li><a blc:paginationpagelink="${1}" th:text="${1}"></a></li>
                <li><a href="javascript:viod(0);" class="disabled">...</a></li>
            </span>
            <li th:each="num : ${#numbers.sequence(start,end)}">
                <a blc:paginationpagelink="${num}" th:text="${num}" th:class="${result.page == num}? 'active'"></a>
            </li>
            <span th:remove="tag" th:if="${end&lt;result.totalPages-1}">
                <li><a href="javascript:viod(0);" class="disabled">...</a></li>
                <li><a blc:paginationpagelink="${result.totalPages}" th:text="${result.totalPages}"></a></li>
            </span>
            <span th:remove="tag" th:if="${end==result.totalPages-1}">
                <li><a blc:paginationpagelink="${result.totalPages}" th:text="${result.totalPages}"></a></li>
            </span>
            <li title="下一页">
                <a th:if="${result.page==result.totalPages}" href="javascript:viod(0);" class="disabled">»</a>
                <a th:unless="${result.page==result.totalPages}" blc:paginationpagelink="${result.page+1}" >
                    <span>»</span>
                </a>
            </li>
        </span>
    </ul>
</div>
